package com.kupurui.asteacher.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.frame.adapter.CommonAdapter;
import com.android.frame.adapter.ViewHolder;
import com.kupurui.asteacher.R;
import com.kupurui.asteacher.bean.JobStudentDetailsInfo;

import java.util.List;

/**
 * Created by Administrator on 2017/7/26.
 */

public class JobStudentDetailsAdapter extends CommonAdapter<JobStudentDetailsInfo.DetailBean> {

    public JobStudentDetailsAdapter(Context context, List<JobStudentDetailsInfo.DetailBean> mList, int itemLayoutId) {
        super(context, mList, itemLayoutId);
    }

    @Override
    public void convert(ViewHolder holder, JobStudentDetailsInfo.DetailBean item, int positon) {
        holder.setTextViewText(R.id.tv_num,(positon+1)+"");
        ImageView ivStatus = holder.getView(R.id.iv_status);
        TextView tvUncorrect = holder.getView(R.id.tv_uncorrect);

        if (item.getStatus().equals("1")){
            tvUncorrect.setVisibility(View.VISIBLE);
            ivStatus.setVisibility(View.GONE);
        }else{
            tvUncorrect.setVisibility(View.GONE);
            ivStatus.setVisibility(View.VISIBLE);
        }

        if (item.getStatus().equals("0")){
            ivStatus.setImageDrawable(mContext.getResources().getDrawable(R.drawable.imgv_details_erorrs));
//            ivStatus.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.imgv_details_erorrs));
        }else if (item.getStatus().equals("2")){
            ivStatus.setImageDrawable(mContext.getResources().getDrawable(R.drawable.imgv_details_correct));
//            ivStatus.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.imgv_details_correct));
        }else if(item.getStatus().equals("3")){
            ivStatus.setImageDrawable(mContext.getResources().getDrawable(R.drawable.imgv_details_half_correct));
//            ivStatus.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.imgv_details_half_correct));
        }
    }
}
